/**
 *
 */
package org.jprobe.classpath;

import java.util.HashSet;
import java.util.Set;

/**
 * A package data structure
 * @author Hussain Al-Mutawa
 * @version 1.0
 * @since 1.0
 */
public class Package implements PackageInterface {
	/** the name of the package **/
	protected transient final String name;
	/** set of classes in the package **/
	protected transient final Set<String>classes;
	/** class path of the package **/
	protected transient final String classPath;
	private transient int classesCount=0;
	/**
	 * initializes a new package data structure
	 * @param classpath the class path from which the package was taken
	 * @param name the name of the package
	 */
	public Package(final String classPath,final String name) {
		super();
		this.classPath=classPath;
		this.name=name;
		this.classes=new HashSet<String>();
	}
	@Override
	public Set<String> getClasses() {
		return classes;
	}
	@Override
	public String getName() {
		return name;
	}
	@Override
	public void addClass(final String className) {
		this.classes.add(className);
		classesCount++;
	}
	@Override
	public String toString() {
		return "Package " + name + ", from : " + classPath;
	}
	@Override
	public String getClasspath() {
		return classPath;
	}
	@Override
	public int getClassesCount() {
		return classesCount;
	}
}